﻿using System.Collections.Generic;

namespace SmallShop.Services.Code
{
    public abstract class DictionaryFormat
    {
        protected Dictionary<string, string> Dictionary;

        protected DictionaryFormat()
        {
            Dictionary = new Dictionary<string, string>();
        }

        public string GetStringDictionary()
        {
            string output = "";
            foreach (var item in Dictionary)
            {
                if (output.Equals(""))
                {
                    output += item.Key + ":" + item.Value;
                }
                else
                {
                    output += ";" + item.Key + ":" + item.Value;
                }
            }
            return output;
        }

        public Dictionary<string, string> GetDictionary()
        {
            return Dictionary;
        }
    }

    public class DictionaryMessage : DictionaryFormat
    {
        public DictionaryMessage(string receiveremail, string sendername, string provide, string cvsid)
            : base()
        {
            Dictionary.Add("receiveremail", receiveremail);
            Dictionary.Add("sendername", sendername);
            Dictionary.Add("provide", provide);
            Dictionary.Add("cvsid", cvsid);
        }
        public static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "cvsid" };
        }
    }
    public class DictionaryForwardMessage : DictionaryMessage
    {
        public DictionaryForwardMessage(string receiveremail, string sendername, string provide, string cvsid,string content)
            : base(receiveremail,sendername,provide,cvsid)
        {
            Dictionary.Add("content", content);
        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryMessage.AvaiableKey();
            lst.Add("content");
            return lst;
        }
    }
    public class DictionaryMessageBid : DictionaryMessage
    {
        public DictionaryMessageBid(string receiveremail, string sendername, string provide, string cvsid, string bidprice)
            : base(receiveremail, sendername, provide, cvsid)
        {
            Dictionary.Add("bidprice", bidprice);
        }
        public new static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "cvsid", "bidprice" };
        }
    }
    public class DictionaryOrderProvide : DictionaryFormat
    {
        public DictionaryOrderProvide(string receiveremail, string sendername, string provide, string orderid, string cvsid, string provideid)
            : base()
        {
            Dictionary.Add("receiveremail", receiveremail);
            Dictionary.Add("sendername", sendername);
            Dictionary.Add("provide", provide);
            Dictionary.Add("orderid", orderid);
            Dictionary.Add("cvsid", cvsid);
            Dictionary.Add("provideid", provideid);
        }
        public static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "orderid", "cvsid", "provideid" };
        }
    }
    public class DictionaryOrderRequest : DictionaryFormat
    {
        public DictionaryOrderRequest(string receiveremail, string sendername, string request, string orderid, string cvsid, string provideid)
            : base()
        {
            Dictionary.Add("receiveremail", receiveremail);
            Dictionary.Add("sendername", sendername);
            Dictionary.Add("provide", request);
            Dictionary.Add("orderid", orderid);
            Dictionary.Add("cvsid", cvsid);
            Dictionary.Add("provideid", provideid);
        }
        public static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "orderid", "cvsid", "provideid" };
        }
    }
    public class DictionaryOrderDone : DictionaryOrderProvide
    {
        public DictionaryOrderDone(string receiveremail, string sendername, string provide, string orderid, string cvsid, string provideid)
            : base(receiveremail, sendername, provide, orderid, cvsid, provideid)
        {

        }
        public new static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "orderid", "cvsid", "provideid" };
        }
    }
    public class DictionaryOrderCancel : DictionaryOrderProvide
    {
        public DictionaryOrderCancel(string receiveremail, string sendername, string provide, string orderid, string cvsid, string provideid)
            : base(receiveremail, sendername, provide, orderid, cvsid, provideid)
        {
           
        }
        public new static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "provide", "orderid", "cvsid", "provideid" };
        }
    }
    public class DictionaryTransaction : DictionaryFormat
    {
        public DictionaryTransaction(string receiveremail, string sendername,string amount,string provide,string provideid)
            : base()
        {
            Dictionary.Add("receiveremail", receiveremail);
            Dictionary.Add("sendername", sendername);
            Dictionary.Add("amount", amount);
            Dictionary.Add("provide",provide);
            Dictionary.Add("provideid", provideid);
        }
        public static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "sendername", "amount","provide","provideid" };
        }
    }
    public class DictionaryTransactionSuccess : DictionaryTransaction
    {
        public DictionaryTransactionSuccess(string receiveremail, string sendername, string amount, string provide, string provideid)
            : base(receiveremail, sendername,amount,provide,provideid)
        {

        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransaction.AvaiableKey();
            return lst;
        }
    }
    public class DictionaryTransactionFailed : DictionaryTransaction
    {
        public DictionaryTransactionFailed(string receiveremail, string sendername,string amount, string errorinfo,string provide,string provideid)
            : base(receiveremail, sendername,amount,provide,provideid)
        {
            Dictionary.Add("errorinfo", errorinfo);
        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransaction.AvaiableKey();
            lst.Add("errorinfo");
               return lst;
        }
    }
    public class DictionaryTransactionPremiumSuccess : DictionaryTransactionSuccess
    {
        public DictionaryTransactionPremiumSuccess(string receiveremail, string sendername, string amount,string premiumto)
            : base(receiveremail, sendername, amount,"","")
        {
            Dictionary.Add("premiumto", premiumto);
        }
        public new  static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionSuccess.AvaiableKey();
            lst.Add("premiumto");
            return lst;
        }
    }
    public class DictionaryTransactionPremiumFailed : DictionaryTransactionFailed
    {
        public DictionaryTransactionPremiumFailed(string receiveremail, string sendername, string amount, string errorinfo)
            : base(receiveremail, sendername, amount, errorinfo,"","")
        {
            
        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionFailed.AvaiableKey();
            return lst;
        }
    }
    public class DictionaryTransactionOrderStep1Success : DictionaryTransactionSuccess
    {
        public DictionaryTransactionOrderStep1Success(string receiveremail, string sendername, string amount,string provide,string provideid)
            : base(receiveremail, sendername, amount,provide,provideid)
        {
           
        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionSuccess.AvaiableKey()  ;
            return lst;
        }
    }
    public class DictionaryTransactionOrderStep1Failed : DictionaryTransactionFailed
    {
        public DictionaryTransactionOrderStep1Failed(string receiveremail, string sendername, string amount, string errorinfo,string provide,string provideid)
            : base(receiveremail, sendername, amount, errorinfo,provide,provideid)
        {

        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionFailed.AvaiableKey();
            return lst;
        }
    }
    public class DictionaryTransactionOrderStep2Success : DictionaryTransactionSuccess
    {
        public DictionaryTransactionOrderStep2Success(string receiveremail, string sendername, string amount,string provide,string provideid)
            : base(receiveremail, sendername, amount,provide,provideid)
        {

        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionSuccess.AvaiableKey();
            return lst;
        }
    }
    public class DictionaryTransactionOrderStep2Failed : DictionaryTransactionFailed
    {
        public DictionaryTransactionOrderStep2Failed(string receiveremail, string sendername, string amount, string errorinfo,string provide,string provideid)
            : base(receiveremail, sendername, amount, errorinfo,provide,provideid)
        {

        }
        public new static List<string> AvaiableKey()
        {
            var lst = DictionaryTransactionFailed.AvaiableKey();
            return lst;
        }
    }
    public class DictionaryVerifyCode : DictionaryFormat
    {
        public DictionaryVerifyCode(string receiveremail, string code)
            : base()
        {
            Dictionary.Add("receiveremail", receiveremail);
            Dictionary.Add("code", code);
        }
        public static List<string> AvaiableKey()
        {
            return new List<string>() { "receiveremail", "code" };
        }
    }
}